Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web Bluetooth] Add Read descriptors sample #478

Conversation

@beaufortfrancois beaufortfrancois force-pushed the readClientCharacteristicConfiguration branch from 2349fb1 to 0802f6b Compare January 30, 2017 15:57
await descriptor.readValue().then(value => {
log('> Client Characteristic Configuration:');
log(' > Notifications: ' + (value.getUint8(0) ? 'ON' : 'OFF'));
log(' > Indications: ' + (value.getUint8(1) ? 'ON' : 'OFF'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fetching the 2nd byte, but you intended to select the 2nd bit. Use something like:
value.getUint8(0) & 0b01 // notifications
value.getUint8(0) & 0b10 // indications

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rookie mistake. Thanks for catching this @scheib
ES6 binary notation to the rescue!

@beaufortfrancois
Copy link
Member Author

@scheib WDYT?

@beaufortfrancois
Copy link
Member Author

For info, I've just submitted a PR at rouge-ruby/rouge#619 to make ES6 Binary literals and Octal literals highlighting works.

@beaufortfrancois beaufortfrancois merged commit 5d69758 into GoogleChrome:gh-pages Feb 1, 2017
@beaufortfrancois beaufortfrancois deleted the readClientCharacteristicConfiguration branch February 1, 2017 07:35
@tri-cloud
Copy link

Links giving me nothing but 404 pages someone give me a BLE Bluetooth link or download access please

@beaufortfrancois
Copy link
Member Author

You can find all samples at https://googlechrome.github.io/samples/web-bluetooth/index.html

markafoltz pushed a commit that referenced this pull request Oct 14, 2024
* [Web Bluetooth] Add Read descriptors sample

* Fix byte/bit mistake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants